package end.ser.imp;

import java.util.List;
import end.dao.BaseMapper;
import end.ser.BaseSER;

/**
 * 
 * BaseSERImp.java 2016-6-27
 * 
 * Copyright zhaocj Inc. All rights reserved. Love Me Like Love Justin Bieber
 */
public class BaseSERImp<T> implements BaseSER<T> {
	private BaseMapper<T> mapperDAO;

	public BaseMapper<T> getMapperDAO() {
		return mapperDAO;
	}

	public void setMapperDAO(BaseMapper<T> mapperDAO) {
		this.mapperDAO = mapperDAO;
	}

	@Override
	public T selectByPrimaryKey(Object key) throws Exception {
		return getMapperDAO().selectByPrimaryKey(key);
	}

	@Override
	public Integer updateByPrimaryKey(T t) throws Exception {
		return getMapperDAO().updateByPrimaryKey(t);
	}

	@Override
	public Integer deleteByPrimaryKey(Object key) throws Exception {
		return getMapperDAO().deleteByPrimaryKey(key);
	}

	@Override
	public Integer insert(T t) throws Exception {
		return getMapperDAO().insert(t);
	}

	@Override
	public List<T> selectByBean(T t) throws Exception {
		return getMapperDAO().selectByBean(t);
	}

	@Override
	public Integer deleteByPrimaryKeys(Object... keys) throws Exception {
		int i = 0;
		for (Object key : keys) {
			i += getMapperDAO().deleteByPrimaryKey(key);
		}
		return i;
	}

	@Override
	public Integer selectByBeanCount(T t) throws Exception {
		return getMapperDAO().selectByBeanCount(t);
	}

	@Override
	public Integer deleteByBean(T t) throws Exception {
		return getMapperDAO().deleteByBean(t);
	}

	@Override
	public List<T> selectByMap(Object obj) throws Exception {
		return getMapperDAO().selectByMap(obj);
	}

}
